from openai import OpenAI
#import AiUtil
import com.lxk.ai.AiUtil
from com.lxk.ai import AiUtil

client = AiUtil.getOpenAI()

response = client.chat.completions.create(
    model="gpt-4-vision-preview",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "基于这张图片，生成前端网站的代码。1.每个元素都要渲染出来 2.进行适当的美化 3.需要生成 html、css 代码 4.底栏不随滚动变化 5.导航栏在网站上部居中 6.css代码就卸载 html 中 7.颜色适当美化一下"},
                {
                    "type": "image_url",
                    "image_url": "https://cms.hidmengine.com/upload/WechatIMG4675.jpg",
                },
            ],
        }
    ],
    max_tokens=4000,
)

print(response.choices[0].message.content)
